import Cookies from 'js-cookie'
import store from "@/store";

const TokenKey = 'Agent-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

/**
 * 打开美客多授权页面
 */
export function mkdAuth(){
  const state = store.getters.authState;
  const redirectUrl = `https://global-selling.mercadolibre.com/authorization?response_type=code&client_id=4778705839480848&state=${state}&redirect_uri=https%3A%2F%2Fapi.minodm.com%2Fredirect`
  window.open(redirectUrl ,'_blank')
}
